{% extends "cms/cms_base.html" %}
{% from "common/macros.html" import static %}

{% block title %}
    板块管理页面
{% endblock %}

{% block page_title %}
    {{ self.title() }}
{% endblock %}

{% block head %}
    <script src="{{ static("cms/js/boards.js") }}"></script>
{% endblock %}

{% block main_context %}
    <div class="top-box ">
        <button class="btn btn-warning" id="add-boards-btn">添加板块</button>
    </div>

    <table class="table table-bordered">
        <tr>
            <th>模块名称</th>
            <th>帖子数量</th>
            <th>创建时间</th>
            <th>操作</th>
        </tr>
        <tbody>

{#      通过**context 直接获取到了 字典的内容，此时boards == context.boards#}
        {% for board in boards %}
            <tr data-name="{{ board.name }}" data-id="{{ board.id }}">
                <td>{{ board.name }}</td>
                <td>0</td>
                <td>{{ board.create_time }}</td>
                <td>
                    <button class="btn btn-default btn-xs save-board-btn">编辑</button>
                    <button class="btn btn-danger btn-xs  delete-board-btn">删除</button>
                </td>
            </tr>
        {% endfor %}

        </tbody>
    </table>
{% endblock %}